package com.che.software.testato.util;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.io.Serializable;

import org.apache.log4j.Logger;

/**
 * Static class used to centralize the diagrams colors and utils.
 * 
 * @author Clement HELIOU (clement.heliou@che-software.com).
 * @copyright Che Software.
 * @license GNU General Public License.
 * @see Serializable.
 * @since August, 2011.
 * 
 *        This file is part of Testato.
 * 
 *        Testato is free software: you can redistribute it and/or modify it
 *        under the terms of the GNU General Public License as published by the
 *        Free Software Foundation, either version 3 of the License, or (at your
 *        option) any later version.
 * 
 *        Testato is distributed in the hope that it will be useful, but WITHOUT
 *        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *        FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 *        for more details.
 * 
 *        You should have received a copy of the GNU General Public License
 *        along with Testato. If not, see <http://www.gnu.org/licenses/>.
 * 
 *        Testato's logo is a creation of Arrioch
 *        (http://arrioch.deviantart.com/) and it's distributed under the terms
 *        of the Creative Commons License.
 */
public class ColorUtil implements Serializable {

	/**
	 * Constants.
	 */
	private static final Logger LOGGER = Logger.getLogger(ColorUtil.class);
	private static final long serialVersionUID = 146761543370272611L;
	public static final Dimension FULL_SCREEN_SIZE = new Dimension(1400, 700), MICRO_SIZE = new Dimension(500, 277), REDUCE_SIZE = new Dimension(760, 340);
	public static final Font DEFAULT_FONT = new Font(null, Font.BOLD, 12), TITLE_FONT = new Font(null, Font.BOLD, 16);
	public static final int[] BLUE_COLOR = { 146, 205, 220 }, DARK_BLUE_COLOR = { 23, 54, 93 }, GREY_COLOR = { 247, 247, 247 }, ORANGE_COLOR = { 255, 153, 0 };

	/**
	 * Private default builder; this a static class.
	 */
	private ColorUtil() {
	}

	/**
	 * Return the color corresponding to RGB values.
	 * 
	 * @author Clement HELIOU (clement.heliou@che-software.com).
	 * @param red the red value.
	 * @param green the green value.
	 * @param blue the blue value.
	 * @return the resulting color object.
	 * @since July, 2011.
	 */
	public static Color getHSBColor(int red, int green, int blue) {
		LOGGER.debug("getHSBColor().");
		float[] hsbValues = new float[3];
		Color.RGBtoHSB(red, green, blue, hsbValues);
		return Color.getHSBColor(hsbValues[0], hsbValues[1], hsbValues[2]);
	}
}